package com.lotustong.im4d.ipmsg.swt;

import java.util.HashMap;
import java.util.Iterator;

import org.eclipse.swt.graphics.Image;

/**
 *  
 */
public class ImageRegistry {
	private static HashMap images = new HashMap();
	
	/**  */
	public static synchronized Image getImage(String filename){
		if(images.get(filename)!=null){
			return (Image)images.get(filename);
		}
		Image image = new Image(null,filename);
		images.put(filename,image);
		return image;
	}
	
	/** */
	public static synchronized void dispose(){
		Iterator ite = images.values().iterator();
		while(ite.hasNext()){
			Image image = (Image)ite.next();
			image.dispose();
		}
	}
}
